/*
* $Id: HeaderItem.cpp 111 2010-07-01 15:26:44Z volok-aleksej@yandex.ru $
*
* Copyright 2009 by Volokitin Alexey
* All rights reserved
*
*/
#include "Common/include.h"
#include "HeaderItem.h"

CHeaderItem::CHeaderItem(const std::tstring& strName, int nId)
: CEditorItem(strName, nId){
	m_pFont = CCommonFunction::GetFont(_T("Book Antiqua"), m_sizefont, TRUE, TRUE);
}
CHeaderItem::~CHeaderItem(){
	m_pFont->DeleteObject();
	delete m_pFont;
}

void CHeaderItem::Paint(CDC* dc){
	HGDIOBJ oldObj = dc->SelectObject(m_pFont->m_hObject);
	dc->SetBkMode(TRANSPARENT);
	dc->DrawText(m_strName.c_str(), CRect(m_point, m_size), DT_CENTER);
	dc->SelectObject(oldObj);
}
void CHeaderItem::Resize(){
	std::vector<std::tstring> aString = CStringFunction::GetStringArray(m_strName, _T("\n"));
	m_size.cy = (int)aString.size() * m_sizefont + 5;
}